package ThreadDemo3;

/**
 * Created with IntelliJ IDEA.
 * Description:锁操作
 * User: 阿宾
 * Date: 2025-03-24
 * Time: 20:01
 */
public class ThreadDemo3 {
    public static void main(String[] args){
        //创建一个对象
        Object locker = new Object();
        //创建一个线程
        Thread t = new Thread(()->{
            synchronized (locker){
                synchronized (locker){
                    System.out.println("hello world");
                }
            }
        });
        t.start();
    }
}